package com.cfpl.project_common.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NonNull;

/**
 * 肥料使用记录表
 * @TableName fertilizer_usage_records
 */
@TableName(value ="fertilizer_usage_records")
@Data
public class FertilizerUsageRecords implements Serializable {
    /**
     * 唯一编号
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 种植地点ID
     */
    @NonNull
    @ApiModelProperty(required = true)
    private Long plantingLocationId;

    /**
     * 肥料用量,单位kg
     */
    @NonNull
    @ApiModelProperty(required = true)
    private Integer fertilizerDosage;

    /**
     * 施肥日期
     */
    private Date fertilizationTime;

    /**
     * 使用肥料的果蔬ID(施在哪个果蔬上)
     */
    @NonNull
    @ApiModelProperty(required = true)
    private Long vegetableManagerId;

    /**
     * 操作员ID
     */
    private Long adminId;

    /**
     * 领取记录ID
     */
    @NonNull
    @ApiModelProperty(required = true)
    private Long fertilizerAcquireRecordId;

    /**
     * 本次过期是否已处理
     */
    private Integer isProcessed;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        FertilizerUsageRecords other = (FertilizerUsageRecords) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getPlantingLocationId() == null ? other.getPlantingLocationId() == null : this.getPlantingLocationId().equals(other.getPlantingLocationId()))
            && (this.getFertilizerDosage() == null ? other.getFertilizerDosage() == null : this.getFertilizerDosage().equals(other.getFertilizerDosage()))
            && (this.getFertilizationTime() == null ? other.getFertilizationTime() == null : this.getFertilizationTime().equals(other.getFertilizationTime()))
            && (this.getVegetableManagerId() == null ? other.getVegetableManagerId() == null : this.getVegetableManagerId().equals(other.getVegetableManagerId()))
            && (this.getAdminId() == null ? other.getAdminId() == null : this.getAdminId().equals(other.getAdminId()))
            && (this.getFertilizerAcquireRecordId() == null ? other.getFertilizerAcquireRecordId() == null : this.getFertilizerAcquireRecordId().equals(other.getFertilizerAcquireRecordId()))
            && (this.getIsProcessed() == null ? other.getIsProcessed() == null : this.getIsProcessed().equals(other.getIsProcessed()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getPlantingLocationId() == null) ? 0 : getPlantingLocationId().hashCode());
        result = prime * result + ((getFertilizerDosage() == null) ? 0 : getFertilizerDosage().hashCode());
        result = prime * result + ((getFertilizationTime() == null) ? 0 : getFertilizationTime().hashCode());
        result = prime * result + ((getVegetableManagerId() == null) ? 0 : getVegetableManagerId().hashCode());
        result = prime * result + ((getAdminId() == null) ? 0 : getAdminId().hashCode());
        result = prime * result + ((getFertilizerAcquireRecordId() == null) ? 0 : getFertilizerAcquireRecordId().hashCode());
        result = prime * result + ((getIsProcessed() == null) ? 0 : getIsProcessed().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", plantingLocationId=").append(plantingLocationId);
        sb.append(", fertilizerDosage=").append(fertilizerDosage);
        sb.append(", fertilizationTime=").append(fertilizationTime);
        sb.append(", vegetableManagerId=").append(vegetableManagerId);
        sb.append(", adminId=").append(adminId);
        sb.append(", fertilizerAcquireRecordId=").append(fertilizerAcquireRecordId);
        sb.append(", isProcessed=").append(isProcessed);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}